package com.company.cuobuliao.ui.ku;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.company.cuobuliao.R;
import com.company.cuobuliao.adapter.QuestionListAdapter;
import com.company.cuobuliao.base.BaseActivity;
import com.company.cuobuliao.model.Question;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Oreo on 2017/8/16.
 */

public class FindQuestionActivity extends BaseActivity {

    private ListView listView;
    private List<Question> list = new ArrayList<>();
    private QuestionListAdapter adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_findquestion);
        initView();
        fucGetData();
    }

    private void initView() {
        back(R.id.rllyBack);

        listView = (ListView) findViewById(R.id.listView);
        adapter = new QuestionListAdapter(this, list);
        listView.setAdapter(adapter);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                startActivity(new Intent(FindQuestionActivity.this, FindQuestionDeltailActivity.class));
            }
        });
    }

    private void fucGetData() {
        list.add(new Question());
        list.add(new Question());
        list.add(new Question());
        list.add(new Question());
        adapter.notifyDataSetChanged();
    }
}
